import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

@SuppressWarnings("serial")
public class CadastroInstituicaoForm extends ActionForm {
	
	private String municipio;
	private String responsavel;
	private String cargoResponsavel;
	private String tratamentoResponsavel;
	private String endereco;
	private String telefone;
	private String fax;
	private String responsavelArea;
	private String telefoneResponsavelArea;
	private String celularResponsavelArea;
	
	public CadastroInstituicaoForm() { }
	
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		this.municipio = null;
		this.responsavel = null;
		this.cargoResponsavel = null;
		this.tratamentoResponsavel = null;
		this.endereco = null;
		this.telefone = null;
		this.fax = null;
		this.responsavelArea = null;
		this.telefoneResponsavelArea = null;
		this.celularResponsavelArea = null;
	}
	
	//TODO colocar mensagens de erro no application.properties
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		if (this.municipio == null || this.municipio.trim().equals("")){
			errors.add("municipio",	new ActionMessage("erro cadastro"));
		} if (this.responsavel == null || this.responsavel.trim().equals("")){
			errors.add("responsavel",	new ActionMessage("erro cadastro"));
		} if (this.cargoResponsavel == null || this.cargoResponsavel.trim().equals("")){
			errors.add("cargoResponsavel",	new ActionMessage("erro cadastro"));
		} if (this.tratamentoResponsavel == null || this.tratamentoResponsavel.trim().equals("")){
			errors.add("tratamentoResponsavel",	new ActionMessage("erro cadastro"));
		} if (this.endereco == null || this.endereco.trim().equals("")){
			errors.add("endereco",	new ActionMessage("erro cadastro"));
		} if (this.telefone == null || this.telefone.trim().equals("")){
			errors.add("telefone",	new ActionMessage("erro cadastro"));
		} if (this.fax == null || this.fax.trim().equals("")){
			errors.add("fax",	new ActionMessage("erro cadastro"));
		} 
		
		return errors;
	}
	
	public String getMunicipio() {
		return municipio;
	}
	
	public void setMunicipio(String municipio) {
		this.municipio = municipio;
	}
	
	public String getResponsavel() {
		return responsavel;
	}
	
	public void setResponsavel(String responsavel) {
		this.responsavel = responsavel;
	}
	
	public String getCargoResponsavel() {
		return cargoResponsavel;
	}
	
	public void setCargoResponsavel(String cargoResponsavel) {
		this.cargoResponsavel = cargoResponsavel;
	}
	
	public String getTratamentoResponsavel() {
		return tratamentoResponsavel;
	}
	
	public void setTratamentoResponsavel(String tratamentoResponsavel) {
		this.tratamentoResponsavel = tratamentoResponsavel;
	}
	
	public String getEndereco() {
		return endereco;
	}
	
	public void setEndereco(String endereco) {
		this.endereco = endereco;
	}
	
	public String getTelefone() {
		return telefone;
	}
	
	public void setTelefone(String telefone) {
		this.telefone = telefone;
	}
	
	public String getFax() {
		return fax;
	}
	
	public void setFax(String fax) {
		this.fax = fax;
	}
	
	public String getResponsavelArea() {
		return responsavelArea;
	}
	
	public void setResponsavelArea(String responsavelArea) {
		this.responsavelArea = responsavelArea;
	}
	
	public String getTelefoneResponsavelArea() {
		return telefoneResponsavelArea;
	}
	
	public void setTelefoneResponsavelArea(String telefoneResponsavelArea) {
		this.telefoneResponsavelArea = telefoneResponsavelArea;
	}
	
	public String getCelularResponsavelArea() {
		return celularResponsavelArea;
	}
	
	public void setCelularResponsavelArea(String celularResponsavelArea) {
		this.celularResponsavelArea = celularResponsavelArea;
	}

}
